﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace tv_control_person
{
    class RemoteControl
    {
        TV myTV = new TV();

        private bool _isPowered;        

        private String _channel1;
        public String Channel1 
        {
            get { return _channel1; }
            set { _channel1 = value; }
        }


        private String _channel2;
        public String Channel2
        {
            get { return _channel2; }
            set { _channel2 = value; }
        }


        private int _volume;

        public const int maxVolume = 100;
        public const int minVolume = 0;       

        public void Power()
        {
            _isPowered = !_isPowered;
            myTV.DisplayAction(_isPowered);
        }

        public void ChangeChannel(string someChannel)
        {
            if (_isPowered)
            myTV.DisplayAction(someChannel);            
        }

        public void MakeLouder(int volume)
        {
            if (_isPowered)
            {
                if (_volume + volume > maxVolume)
                {
                    volume = maxVolume;
                }
                else _volume += volume;
                myTV.DisplayAction(_volume);
            }
        }

        public void MakeQuieter(int volume)
        {
            if (_isPowered)
            {
                if (_volume - volume < minVolume)
                {
                    volume = minVolume;
                }
                else _volume -= volume;
                myTV.DisplayAction(_volume);
            }
        }
    }
}
